//
// Created by yhy on 17-2-26.
//

#include "HttpRequest.h"
#include <sstream>
#include <iostream>

HttpRequest::HttpRequest( std::string& data ) {
    Poco::Net::HTTPRequest* request = new Poco::Net::HTTPRequest();

    std::istringstream ss(data);
    request->read(ss);

    std::cout << "=========================host:" << request->getHost() << std::endl;
    std::cout << "=========================uri:"<< request->getURI() << std::endl;
    std::cout << "=========================contentLength:" << request->getContentLength() << std::endl;


    Poco::Net::NameValueCollection cookies;
    request->getCookies( cookies );

    std::cout << "=========================cookie start:\n" << std::endl;

    for( auto i : cookies ){
        std::cout << "key:" << i.first << "              value:" << i.second << std::endl;
    }
    std::cout << "=========================cookie end==========================\n\n\n\n" << std::endl;

}
